/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// p2dpoly.hpp - Peg2DPolygon definition file. This is an abstraction up
//               for having self drawing polygon things that can act a bit
//               like a sprite.
//
// Author: Jim DeLisle
//
// Copyright (c) 1997-2001 Swell Software 
//              All Rights Reserved.
//
// Unauthorized redistribution of this source code, in whole or part,
// without the express written permission of Swell Software
// is strictly prohibited.
//
// Notes:
//
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/

#ifndef _PEG2DPOLYGON_
#define _PEG2DPOLYGON_

class Peg2DPolygon : public PegThing
{
    public:
        Peg2DPolygon(const PegRect& Rect, PegPoint* pPoints,
                     PEGUINT NumPoints, PEGUSHORT Id = 0, 
                     PEGULONG Style = FF_NONE);
        // Copy Constructor
        Peg2DPolygon(Peg2DPolygon const& rhs);

        virtual ~Peg2DPolygon();

        virtual void Draw(const PegRect &Invalid);

        // Accessors
        PEGINT GetCurAngle() const { return mTheta; }
        PEGBOOL GetFill() const { return mFilled; }
        PEGINT GetLineWidth() const { return mLineWidth; }
        PEGUINT GetNumPoints() const { return mNumPoints; }
        
        virtual void ParentShift(PEGINT XOffset, PEGINT YOffset);
        virtual void Resize(const PegRect &Size);

        // Mutators
        void SetCurAngle(PEGINT Theta);
        void SetFill(PEGBOOL Fill) { mFilled = Fill; }
        void SetLineWidth(PEGINT LineWidth) { mLineWidth = LineWidth; }

        // Assignment Operator
        Peg2DPolygon & operator=(const Peg2DPolygon &rhs);

    protected:
        void MapPolygonToReal();

        PegPoint*   mpPoints;
        PegPoint*   mpRotPoints;
        PEGUINT     mNumPoints;
        PEGINT      mTheta;
        PEGINT      mLineWidth;
        PEGBOOL     mFilled;
        PEGBOOL     mCopy;
};

#endif // _PEG2DPOLYGON_

